import java.util.*;

/**
 * @author LKQ
 * @date 2022/4/1 20:13
 * @description 思路：双指针，i 前面都为1时，left转换为 i+1
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int numTimesAllBlue(int[] flips) {
        int n = flips.length;
        int right = 0;
        int max = -1;
        int ans = 0;
        while (right < n) {
            if (flips[right] > max) {
                max = flips[right];
            }
            if (right + 1 == max) {
                ans++;
            }
            right++;
        }
        return ans;
    }
}
